home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / tcqbsnip.zip / CALCPAL.BAS < prev    next >
BASIC Source File  |  1997-06-20  |  565b  |  29 lines

  1. ' CALCPAL.BAS
  2. ' by Tika Carr
  3. '
  4. ' Donated to the public domain
  5. ' No warranties or guarantees are expressed or implied.
  6. '
  7. ' Purpose: Calculates palette for modes 11 - 13
  8.  
  9. DECLARE FUNCTION CalcPal! (mode%, r%, g%, b%)
  10.  
  11. DEFINT A-Z
  12.  
  13. 'demo
  14. SCREEN 13
  15. x! = CalcPal!(13, 63, 40, 40)
  16. PRINT x!
  17. PALETTE 0, x!
  18. DO UNTIL LEN(INKEY$): LOOP
  19. SCREEN 0: WIDTH 80: COLOR 7, 0: CLS : END
  20.  
  21. FUNCTION CalcPal! (mode%, r%, g%, b%)
  22. IF r% > 63 THEN r% = 63
  23. IF g% > 63 THEN g% = 63
  24. IF b% > 63 THEN b% = 63
  25. PALETTE
  26. CalcPal! = 65536 * b% + 256 * g% + r%
  27. END FUNCTION
  28.  
  29.